@extends('host.common.common')

@section('body')
        <!-- top_test -->
<div id="top_test"> </div>

<div class="com-w">
    <div class="wrapper clearfix">
        <div class="fl">
            <img id="web-logo" src="" />
        </div>
        <div class="fl comm-regist-title">
            测试页面
        </div>
    </div>
</div>

<div class="com-w mt10">

    <div class="wrapper  comm-border-d clearfix electronic" style="height:300px">

        <div class="upload-image clearfix" id="regist-elec-docs">
            <div class="image-list" id="aa">
                <div class="img">
                    <img src="" />
                </div>
                <div class="img-text">
                    身份证（正面）
                </div>
                <input type="file" style="display: none;" name="legal_identity_a" id="legal_identity_a" />
            </div>
            <div class="image-list">
                <div class="img">
                    <img src="" />
                </div>
                <div class="img-text">
                    身份证（反面）
                </div>
                <input type="file" style="display: none;" name="legal_identity_b" id="legal_identity_b" />
            </div>

        </div>
    </div>
</div>

<!-- foot_nav -->
<div id="foot_nav"> </div>
<div id="bottom_main"> </div>

<!-- template -->

<script type="text/template" id="item-template">

</script>

<!-- JS -->

<script src="/assets/b2b/js/libs/jquery.validate.min.js"></script>
<script src="/assets/b2b/js/libs/underscore-min.js"></script>

<script src="/assets/b2b/js/libs/messages_zh.js"></script>
<script src="/assets/b2b/js/libs/dialog-min.js"></script>
<script src="/assets/b2b/js/libs/jquery.ajaxfileupload.js"></script>

<script src="/assets/b2b/js/libs/page/template-util.js"></script>
<script src="/assets/b2b/js/libs/mockTest/jquery.mockjax.min.js"></script>
<script src="/assets/b2b/js/libs/mockTest/mock-data.js"></script>

<script>

    $(function(){


        // 选择文件
        $("#regist-elec-docs").on("click", ".image-list", function () {
            var fileObj = $(this).find("[type='file']");
            fileObj[0].click();
        });

        $("#legal_identity_a").on("change", function(){
            $(this).AjaxFileUpload({
                action : PAGE_CONFIG.requestUrl.uploadimg,
                onComplete : function(filename, response){
                    console.log("legal_identity_a >>> ");
                    $(this).parent().find("img").attr("src", filename);
                }
            });
        });

        $("#legal_identity_b").AjaxFileUpload({
            action : PAGE_CONFIG.requestUrl.uploadimg,
            onComplete : function (filename, response) {
                console.log("legal_identity_b >>> ");
                $(this).parent().find("img").attr("src", filename);
            }
        });

    });


</script>
@stop